package com.sphd.emanu.activity.storeroom;

import android.support.v7.app.AlertDialog;
import android.view.View;

import com.google.gson.JsonObject;
import com.sphd.emanu.mvp.BasePresenterImpl;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

/**
 * MVPPlugin
 *  邮箱 784787081@qq.com
 */

public class StoreroomPresenter extends BasePresenterImpl<StoreroomContract.View> implements StoreroomContract.Presenter{

    @Override
    public void addMaterialCategory(Integer level, String name, Integer org, final AlertDialog viewDialog) {
        emanuService.addMaterialCategory(level, name, org).enqueue(new Callback<JsonObject>() {
            @Override
            public void onResponse(Call<JsonObject> call, Response<JsonObject> response) {
                mView.setAddRes(res(response),viewDialog);
            }

            @Override
            public void onFailure(Call<JsonObject> call, Throwable t) {
                Error(t);
            }
        });
    }
}
